<?php


namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;


/**
 * kys
 * Class Goods
 * @package App\Models
 */
class Goods extends Model
{
    use HasFactory;

    public $table = 'zfm_goods';

    /**
     * 商品信息展示
     * @return mixed
     */
    public static function list()
    {
        return self::paginate(10);
    }

    /**
     * 商品信息搜索
     * @param $field
     * @param $where
     * @return mixed
     */
    public static function Seek($field,$where)
    {
        return self::where($field,'like',"%$where%")->get();
    }

    /**
     * 商品信息删除
     * @param $id
     * @param $fangId
     * @return mixed
     */

    public static function del($id,$goodsId)
    {
        return self::where([$id=>$goodsId])->delete();
    }
    /**
     * 商品详情信息
     */
    public static function detail($field,$where){
        return self::where($field,$where)->first();
    }
    /**
     * 商品信息修改
     */
    public static function change($field,$goodsId,$SecondaryMessageUpdated){
        return self::where($field,$goodsId,$goodsId)->update($SecondaryMessageUpdated);
    }

    /**
     * 商品添加
     * @param $params
     * @return mixed
     */
    public static function create($params){
        return self::insert($params);
    }
}
